package com.webapp.domain.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * 纠纷内容表
 * @author zern
 *
 */
@Entity
@Table(name = "disputes_data")
public class DisputesData extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5316171944435975114L;
	
	private Long id;		// id
		
	private Disputes disputes;		// 关联纠纷外键
	
	private String title;			// 纠纷咨询标题
	
	private String content;			//	纠纷内容
	
	private Date createTime;		//	创建时间
	
	private List<Attachment> attachments;	// 附件
	
	private DisputesMessage disputesMessage;
	
	public DisputesData() {
		super();
	}


	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "disputes_id",referencedColumnName = "id")
	@JSONField(serialize = false)
	public Disputes getDisputes() {
		return disputes;
	}

	public void setDisputes(Disputes disputes) {
		this.disputes = disputes;
	}


	@Column(name = "content", length = 2000)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "title", length = 200)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@OneToMany(mappedBy = "disputesData",cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JSONField(serialize = false)
	public List<Attachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}


	@OneToOne( fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "disputes_message_id",referencedColumnName = "id")
	@JSONField(serialize = false)
	public DisputesMessage getDisputesMessage() {
		return disputesMessage;
	}


	public void setDisputesMessage(DisputesMessage disputesMessage) {
		this.disputesMessage = disputesMessage;
	}

}
